<div style="clear:both;"></div>

<fieldset class="form-group">
  <legend><?php echo $title ?></legend>

  <?php while ($element = $elements->next()) {
    echo $element->render($obj, $action);
  } ?>
</fieldset>

<div style="clear:both;"></div>